<extend name="Base/common"/>

<block name="style">
    <link href="__CSS__/event.css" rel="stylesheet" type="text/css"/>
</block>
<block name="body">
	<div class="m-banner"><img src="__PUBLIC__/images/banner1.jpg"></div>
		<div class="container index-project index-project-mp con-color am-cf">
	    <!--搜索等-->
		<include file="Public/search_e"/>
	    <!--搜索等-->
    	<!--副标题-->
        <div class="path am-padding-1-sm am-padding-horizontal-md am-padding-horizontal-lg am-margin-bottom am-cf">
            <div class="subtitle  am-u-sm-12 am-u-md-6 am-u-lg-6 am-padding-0-sm">
                <strong>V</strong>
                <h3>志愿项目<span>详情</span></h3>
                <p>
                    志/愿/青/春&nbsp;爱/我/寿/光<br/>
                    OLUNTEER PROJECT
                </p>
            </div>
            <!--已经登陆成功-->
            <include file="Public/detail_login"/>
        </div>
    <!--副标题-->
  <!--项目介绍-->
        <div class="am-cf row project-des am-padding-top-sm am-padding-top-md am-padding-top-lg">
            
            <div class="am-fr am-u-sm-12 am-u-md-8">
                <div class="huodong-title">{$content.title}</div>
                <ul class="row am-padding-0">
                  	<li class="am-u-sm-12 am-u-md-6 am-u-lg-6">{:L('_SPONSOR_')}{:L('_COLON_')}<a class="event_count" href="{$content.user.space_url}">{$content.user.nickname}</a></li>
                   
                  	<li class="am-u-sm-12 am-u-md-6 am-u-lg-6">{:L('_EVENT_CATEGORY_')}：{$content.type.title}</li>                                   
                    <li class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                       	人数限制：{$content.limitCount}{:L('_PEER_')}&nbsp;&nbsp;&nbsp;
                       	已报名：{$content.signCount}{:L('_PEER_')}&nbsp;&nbsp;&nbsp;
                       	{:L('_ALREADY_IN_')}{:L('_COLON_')}{$content.attentionCount}{:L('_PEER_')}
                    </li>
                    <li class="am-u-sm-12 am-u-md-6 am-u-lg-6">{:L('_MOBILE_')}：{$content.user.mobile}</li>
                    <li class="am-u-sm-12 am-u-md-6 am-u-lg-6">{:L('_ADDRESS_')}：{$content.address}</li>
                   
                   
                	<li class="am-u-sm-12 am-u-md-6 am-u-lg-6">{:L('_TIME_')}{:L('_COLON_')}{:date('Y-m-d',$content['sTime'])}--{:date('Y-m-d',$content['eTime'])}</li>
                   <li class="am-u-sm-12 am-u-md-6 am-u-lg-6">{:L('_DEADLINE_REGISTRATION_')}：{:date('Y-m-d',$content['deadline'])}</li>
                  
                    <li class="am-u-sm-12 am-u-md-6 am-u-lg-6" style="float: left;">

                        <php>if($content['uid'] == is_login() || is_administrator(is_login())){</php>

                        <if condition="time() lt $content['eTime']">
                            <a id="endEvent" class="btn btn-default">{:L('_OVER_AHEAD_')}</a>
                        </if>

                        <a href="{:U('edit',array('id'=>$content['id']))}" class="btn btn-default">{:L('_EVENT_EDIT_')}</a>
                        <a id="delEvent" class="btn btn-default">{:L('_EVENT_DELETE_')}</a>
                        <php>}
                            if($content['uid'] != is_login()){
                            if(!$check_isSign){
                            if($content['deadline'] < time()){</php>
                        <a class="btn btn-default  " href="javascript:"
                           onclick="toast.error({:L('')})">{:L('_REGISTRATION_HAS_OVER_')} </a>
                        <php>}else{</php>
                        <if condition="is_login() eq 0">
                            <a class="btn  btn-info  green" href="javascript:"style="color: #fff"
                               onclick="toast.error({:L('_ERROR_REGISTER_AFTER_LOGIN_')})">{:L('_REGISTER_OP_')} </a>
                            <else/>
                            <if condition="check_auth('Event/Index/doSign')">
                                <a class="btn  btn-info  event_sign green" style="color: #fff"
                                   href="{:U('ajax_sign',array('event_id'=>$content['id']))}">{:L('_REGISTER_OP_')} </a>
                            </if>
                        </if>
                        <php>}
                            }else{</php>
                        <a class="btn btn-default" href="javascript:"
                           id="unSign">{:L('_REGISTER_CANCEL_')} </a>

                        <span style="line-height: 34px;float: left"> &nbsp;&nbsp;  {:L('_AUDIT_ED_')}&nbsp;&nbsp;<if
                                condition="$check_isSign[0]['status'] eq 1">{:L('_AUDIT_ED_')}
                            <else/>
                            {:L('_AUDIT_OP_')}
                        </if></span>
                        <php>}
                           }</php>
        			</li>
                </ul>
            </div>
            <div class="am-fl am-u-sm-12 am-u-md-4 am-margin-vertical-sm"><img class="am-u-sm-12" src="{$content.cover_id|getThumbImageById=345,250}"/></div>
        </div>
    <!--项目介绍-->
    <!--项目详情、回顾-->
		<div data-am-widget="tabs" class="row am-tabs am-tabs-default am-cf">
            
            <ul class="am-tabs-nav tabs-nav-w">  
                <li class="am-active am-u-sm-12 am-u-lg-6 am-padding-0"><a href="[data-tab-panel-0]">活动详情</a></li>                                
            </ul>
            <div class="huodong-detail am-text-left ">
            	<div class="share-box">
                    <div class="pull-right">
                        {:W('Common/Share/detailShare')}
                    </div>
                    <span class="pull-right">
                    {:W('Weibo/Share/shareBtn',array('param'=>array('img'=>$cover_path,'title'=>$content['title'],'content'=>$content['explain'],'from'=>$MODULE_ALIAS,'site_link'=>U('Event/Index/detail',array('id'=>$content['id']))),'text'=>"站内分享"))}
                    </span>
               </div>
                <div class="am-tab-panel am-active">
                    {$content.explain}
                </div>
               	<div class="am-text-right">
               		<div  class="am-u-xs-12 am-u-md-4 am-u-lg-3">{:L('_TIME_RELEASE_')}{:L('_COLON_')} {$content.create_time|friendlyDate}</div>
    				<div class="am-u-xs-12 am-u-md-4 am-u-lg-3">{:L('_TIME_UPDATE_')}{:L('_COLON_')} {$content.update_time|friendlyDate}</div>
               	</div>

            </div>
            <div class="participants am-padding-top-sm am-padding-top-md am-padding-top-lg">
                <php>if(ACTION_NAME == 'detail' ){</php>
				<div class="forum_module" style="float: left">
				    <h2 class="event_type_name">{:L('_EVENT_IN_PEOPLE_')} ({$content.attentionCount}{:L('_PEER_')})
				        <a class="pull-right" href="{:U('member',array('id'=>$content['id']))}">{:L('_ALL_')}</a>
				    </h2>
				
				    <div style="width: 100%">
				        <volist name="content['member']" id="vo" offset="0" length="20">
				            <div class="event_type_img">
				                <a href="{$vo.space_url}">
				                    <img ucard="{$vo.id}" src="{$vo.avatar64}" class="avatar-img"/>
				                </a>
				            </div>
				        </volist>
				    </div>
				
				</div>
				<php>}</php>
            </div>
            <div class="comment-box">
                {:hook('localComment', array('path'=>"Event/event/$content[id]", 'uid'=>$content['uid'],'count_model'=>'event','count_field'=>'reply_count','this_url'=>'event/index/detail'))}
            </div>
      	</div>
                  
	</div>
</block>

<block name="script">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <script>
        $(function () {
            $('#top_nav >li >a ').mouseenter(function () {
                $('.children_nav').hide();
                $('#children_' + $(this).attr('data')).show();
            });


            $('.event_sign').magnificPopup({
                type: 'ajax',
                overflowY: 'scroll',
                modal: true,
                callbacks: {
                    ajaxContentAdded: function () {
                        console.log(this.content);
                    }
                }
            });



            /**
             * 取消报名
             * */
            $('#unSign').click(function () {
                if (confirm("{:L('_PROMPT_CANCEL_')}{:L('_QUESTION_')}")) {
                    var event_id = "{$content['id']}";
                    $.post("{:U('Event/Index/unSign')}", {event_id: event_id}, function (res) {
                        if (res.status) {
                            toast.success(res.info);
                            setTimeout(function () {
                                location.reload();
                            }, 1500);
                        }
                        else {
                            toast.error(res.info);
                        }
                    }, 'json');
                }
            });
            /**
             * 删除活动事件
             * */
            $('#delEvent').click(function () {
                if (confirm("{:L('_PROMPT_DELETE_')}{:L('_QUESTION_')}")) {
                    var event_id = "{$content['id']}";
                    $.post("{:U('Event/Index/doDelEvent')}", {event_id: event_id}, function (res) {
                        if (res.status) {
                            toast.success(res.info);
                            setTimeout(function () {
                                location.href = "{:U('index')}";
                            }, 1500);
                        }
                        else {
                            toast.error(res.info);
                        }
                    }, 'json');
                }
            });
            /**
             * 提前结束活动点击事件
             */
            $('#endEvent').click(function () {
                if (confirm("{:L('_PROMPT_OVER_')}{:L('_QUESTION_')}")) {
                    var event_id = "{$content['id']}";
                    $.post("{:U('Event/Index/doEndEvent')}", {event_id: event_id}, function (res) {
                        if (res.status) {
                            toast.success(res.info);
                            setTimeout(function () {
                                location.reload();
                            }, 1500);
                        }
                        else {
                            toast.error(res.info);
                        }
                    }, 'json');
                }
            });
        })
    </script>

</block>

